

import type { Pagination } from "@/types/views/friend";
import request from "./request";
import type { ChatRoomInfo } from "@/types/views/group";
import { Controller } from '@/api/request'
export const chatroomListApi = (params: Pagination & { name: string }) => request<any, ApiRes<{ total: number, rows: ChatRoomInfo[] }>>({
    url: `${Controller.group}/list`,
    params
});
export const allChatroomListApi = () => request<any, ApiRes<ChatRoomInfo[]>>({
    url: `${Controller.group}/all-list`,
});
export const findChatroomApi = (params: { userId1: number, userId2: number }) => request<any, ApiRes<number | null>>({
    url: `${Controller.group}/findChatroom`,
    params
});
export const chatDetailByIdApi = (chatroomId: number) => request<any, ApiRes<ChatRoomInfo>>({
    url: `${Controller.group}/chatroom-detail/${chatroomId}`,
});
export const createOneToOneApi = (friendId: number) => request<any, ApiRes<number>>({
    url: `${Controller.group}/create-one-to-one/${friendId}`,
});
